package com.caigou.modules.gallery.network.api

import com.caigou.comm.base.bean.CommentBean
import com.caigou.comm.base.bean.CommentItemBean
import com.caigou.comm.base.bean.HttpResult
import com.caigou.modules.gallery.bean.GalleryBean
import com.caigou.modules.gallery.bean.GalleryDetailBean
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author #Suyghur.
 * Created on 2021/09/26
 */
interface HttpGalleryApiService {

    @GET("/api/menu/depot/list")
    fun getGalleryList(@Query("type") type: Int): Flow<HttpResult<MutableList<GalleryBean>>>

    @GET("/api/menu/depot/collect/list")
    fun getCollectList(@Query("type") type: Int, @Query("userId") userId: String): Flow<HttpResult<MutableList<GalleryBean>>>

    @GET("/api/prize/period/list")
    fun getPeriodList(@Query("year") year: Int, @Query("type") type: Int): Flow<HttpResult<MutableList<String>>>


    @GET("/api/menu/depot/info")
    fun getGalleryDetail(
        @Query("depotId") depotId: Int, @Query("period") period: Int,
        @Query("type") type: Int, @Query("userId") userId: String
    ): Flow<HttpResult<GalleryDetailBean>>

    @GET("/api/menu/depot/reply/list")
    fun getCommentList(
        @Query("page") page: Int, @Query("limit") limit: Int, @Query("dataId") depotId: Int,
        @Query("detailId") dataId: Int, @Query("type") type: Int,
        @Query("sort") sort: Int, @Query("currentUserId") currentUserId: String
    ): Flow<HttpResult<CommentBean>>

    @GET("/api/menu/depot/reply/details")
    fun getCommentDetail(
        @Query("dataId") dataId: Int, @Query("detailId") depotId: Int, @Query("type") type: Int,
        @Query("replyId") replyId: Int, @Query("userId") userId: String
    ): Flow<HttpResult<CommentItemBean>>

    @POST("/api/menu/depot/reply")
    fun setReply(@Body body: RequestBody): Flow<HttpResult<String>>


    @POST("api/menu/depot/operation/collect")
    fun collect(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/menu/depot/like")
    fun setDetailLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>


    @POST("/api/menu/depot/reply/like")
    fun setCommentLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

}